using System;
using UnityEngine;
using UnityEngine.UI;

[Serializable]
public class ETCArea : MonoBehaviour
{
	public enum AreaPreset
	{
		Choose,
		TopLeft,
		TopRight,
		BottomLeft,
		BottomRight
	}

	public bool show;

	public ETCArea()
	{
		show = true;
	}

	public void Awake()
	{
		GetComponent<Image>().enabled = show;
	}

	public void ApplyPreset(AreaPreset preset)
	{
		RectTransform component = base.transform.parent.GetComponent<RectTransform>();
		switch (preset)
		{
		case AreaPreset.TopRight:
		{
			this.rectTransform().anchoredPosition = new Vector2(component.rect.width / 4f, component.rect.height / 4f);
			this.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, component.rect.width / 2f);
			this.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, component.rect.height / 2f);
			this.rectTransform().anchorMin = new Vector2(1f, 1f);
			this.rectTransform().anchorMax = new Vector2(1f, 1f);
			RectTransform rectTransform4 = this.rectTransform();
			Vector2 sizeDelta7 = this.rectTransform().sizeDelta;
			float x4 = (0f - sizeDelta7.x) / 2f;
			Vector2 sizeDelta8 = this.rectTransform().sizeDelta;
			rectTransform4.anchoredPosition = new Vector2(x4, (0f - sizeDelta8.y) / 2f);
			break;
		}
		case AreaPreset.TopLeft:
		{
			this.rectTransform().anchoredPosition = new Vector2((0f - component.rect.width) / 4f, component.rect.height / 4f);
			this.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, component.rect.width / 2f);
			this.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, component.rect.height / 2f);
			this.rectTransform().anchorMin = new Vector2(0f, 1f);
			this.rectTransform().anchorMax = new Vector2(0f, 1f);
			RectTransform rectTransform3 = this.rectTransform();
			Vector2 sizeDelta5 = this.rectTransform().sizeDelta;
			float x3 = sizeDelta5.x / 2f;
			Vector2 sizeDelta6 = this.rectTransform().sizeDelta;
			rectTransform3.anchoredPosition = new Vector2(x3, (0f - sizeDelta6.y) / 2f);
			break;
		}
		case AreaPreset.BottomRight:
		{
			this.rectTransform().anchoredPosition = new Vector2(component.rect.width / 4f, (0f - component.rect.height) / 4f);
			this.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, component.rect.width / 2f);
			this.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, component.rect.height / 2f);
			this.rectTransform().anchorMin = new Vector2(1f, 0f);
			this.rectTransform().anchorMax = new Vector2(1f, 0f);
			RectTransform rectTransform2 = this.rectTransform();
			Vector2 sizeDelta3 = this.rectTransform().sizeDelta;
			float x2 = (0f - sizeDelta3.x) / 2f;
			Vector2 sizeDelta4 = this.rectTransform().sizeDelta;
			rectTransform2.anchoredPosition = new Vector2(x2, sizeDelta4.y / 2f);
			break;
		}
		case AreaPreset.BottomLeft:
		{
			this.rectTransform().anchoredPosition = new Vector2((0f - component.rect.width) / 4f, (0f - component.rect.height) / 4f);
			this.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, component.rect.width / 2f);
			this.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, component.rect.height / 2f);
			this.rectTransform().anchorMin = new Vector2(0f, 0f);
			this.rectTransform().anchorMax = new Vector2(0f, 0f);
			RectTransform rectTransform = this.rectTransform();
			Vector2 sizeDelta = this.rectTransform().sizeDelta;
			float x = sizeDelta.x / 2f;
			Vector2 sizeDelta2 = this.rectTransform().sizeDelta;
			rectTransform.anchoredPosition = new Vector2(x, sizeDelta2.y / 2f);
			break;
		}
		}
	}
}
